<%@ page import="databean.Email"%>
<%@ page import="java.util.ArrayList" %>

<a href="user-logout.do">Log Out</a><br>

<div id="header">
<h1>Emails</h1>
</div>

<div id="user-view-emails">

<%
	ArrayList<Email> conversationIDs = (ArrayList<Email>) request.getAttribute("conversationIDs");
	
	for (int i=0; i<conversationIDs.size(); i++) {
		
		Email email = conversationIDs.get(i);
		long conversationID = email.getConversationID();
		String conversationIDURL = "./get-emails-by-conversationID.do?conversationID=" + conversationID;
		
%>

		Conversation ID: <a href="<%= conversationIDURL %>"><%= email.getConversationID() %></a><br>
		Status: <%= email.getStatus() %><br>
		Subject: <%= email.getSubject() %><br>
		Timestamp: <%= email.getTimestamp() %><br>
		Number of emails: <%= email.getEmailCount() %><br><br>

<%
	}
%>

<hr>

<%
	ArrayList<Email> emails = (ArrayList<Email>) request.getAttribute("emails");
	
	if (emails!=null) {
		for (int i=0; i<emails.size(); i++) {
			
			Email email = emails.get(i);
			
%>
			Conversation ID: <%= email.getConversationID() %><br>
			Status: <%= email.getStatus() %><br>
			Outlook ID: <%= email.getOutlookID() %><br>
			Email ID: <%= email.getEmailID() %><br>
			Timestamp: <%= email.getTimestamp() %><br>
			Sender: <%= email.getSender() %><br>
			Recipient: <%= email.getRecipient() %><br>
			Subject: <%= email.getSubject() %><br>
			Body: <%= email.getBody() %><br>
			Notes: <%= email.getNotes() %><br><br>
<%
		}
	}
%>


</div>